package com.ocom.oauth;

import cn.hutool.core.util.HexUtil;
import cn.hutool.crypto.SecureUtil;

import java.nio.charset.StandardCharsets;

public class Demo {
    public static void main(String[] args) {
        //下载hutool依赖
        String key = "tbk0Xa67cEePvv14g5Pf1MPzIceQMN14"; // 密钥（8 字节）
        String username = "admin";
        String password = "admin123";
        username = SecureUtil.des(key.getBytes(StandardCharsets.UTF_8)).encryptBase64(username);
        password = SecureUtil.des(key.getBytes(StandardCharsets.UTF_8)).encryptBase64(password);
        System.out.println(HexUtil.encodeHex(username.getBytes(StandardCharsets.UTF_8)));
        System.out.println(HexUtil.encodeHex(password.getBytes(StandardCharsets.UTF_8)));
    }
}
